<template>
    <div>
        <!-- 返回上一级 -->
        <van-nav-bar left-text="取消" left-arrow @click-left="() => (router.push('/home/user'))" />
        <!-- 搜索框 -->
        <van-search v-model="value" shape="round" placeholder="请输入搜索关键词" />
        <van-empty v-if="qsearch.length==0 || value.length==0" image="https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png" image-size="80"
            description="暂无" />
        <!-- 单元格 -->
        <van-cell-group v-for="item in qsearch">
            <van-cell :title="item.goods_name" @click="xq" />
        </van-cell-group>
    </div>
</template>

<script setup>
import { qsearchApi } from '@/api/api';
import router from '@/router';
import { ref, watch } from 'vue';

let qsearch = ref([])
let value = ref('')
watch(value, (val) => {
    console.log(value);
    qsearchApi(val).then(res => {
        console.log('搜索', res);
        qsearch.value = res.data.message

    })

})

const xq = () => {
    router.push('/home/login')
}
</script>

<style lang="scss" scoped></style>